<template>
	<view class="main">

		<!-- 项目列表 -->
		<view v-if="dataList.length != 0" style="padding: 20rpx">
			<view v-for="(item,index) in dataList" :key="item.id">
				<projectName :ccollectData="item"></projectName>
			</view>
		</view>
		<view v-else>
			<u-divider style="padding: 200rpx 0;">暂无数据</u-divider>
		</view>
	</view>
</template>

<script>
	import projectName from "./component/projectName.vue"
	export default {
		components: {
			projectName
		},
		data() {
			return {
				dataList: [],
				time: "",
				requirment: "",
				cycle: "",
				background: {
					background: '#ffffff'
				},
				quaryList: {
					page: 1,
					page_size: 10,
				}

			}
		},
		onLoad() {
			if (!this.$u.untils.isLogin()) return
			// this.getDataList()
		},
		onShow() {
			this.quaryList.page = 1
			this.getDataList()
		},
		onHide() {
			this.dataList = []
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.$options.data().quaryList
			this.dataList = []
			this.getDataList(() => {
				uni.stopPullDownRefresh()
			})
		},
		// 触底
		onReachBottom() {
			this.quaryList.page++
			this.getDataList()
		},
		methods: {
			search() {
				this.$u.route("/pages/list/search/search")
			},
			// 得到数据
			getDataList(callback) {
				this.$u.api.CollectionProjectList(this.quaryList).then(res => {
					if(res.code ==1){
						this.dataList = [...this.dataList, ...res.data]
					}
					callback && callback()
				})
			}
		},



	}
</script>

<style scoped lang="scss">
	// page {
	// 	background-color: rgb(244, 244, 244);
	// }
	.main {
		background-color: #f5f5f5;
		height: 100%;
	}

	.select {
		background-color: white
	}

	.slot-wrap {
		display: flex;
		flex-direction: row-reverse;
		color: #333333;
		font-size: 36rpx;
		justify-content: space-between;
		/* 如果您想让slot内容占满整个导航栏的宽度 */
		flex: 1;
		/* 如果您想让slot内容与导航栏左右有空隙 */
		padding: 0 40rpx;
	}
</style>
